package c08Java集合;

import org.junit.Test;

import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;

/**
 * @author yuanwl
 * @date 2019-08-08 16:03
 */
public class Set集合判断是否相等 {
    @Test
    public void testHashSet() {
        Set<Long> s1 = new HashSet<>();
        s1.add(1L);
        s1.add(2L);

        Set<Long> s2 = new HashSet<>();
        s2.add(1L);
        s2.add(2L);

        System.err.println(s1.equals(s2));
    }

    @Test
    public void testTreeSet() {
        Set<Long> s1 = new TreeSet<>();
        s1.add(1L);
        s1.add(2L);

        Set<Long> s2 = new TreeSet<>();
        s2.add(1L);
        s2.add(2L);

        System.err.println(s1.equals(s2));
    }
}
